<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>Lane Detection for Autonomous Cars: LaneDetector Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Lane Detection for Autonomous Cars
   </div>
   <div id="projectbrief">Lane Detection Module using C++ and OpenCV</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classLaneDetector-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">LaneDetector Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Definition of the <a class="el" href="classLaneDetector.html" title="Definition of the LaneDetector class. It contains all the functions and variables depicted in the...">LaneDetector</a> class. It contains all the functions and variables depicted in the.  
 <a href="classLaneDetector.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="LaneDetector_8hpp_source.html">LaneDetector.hpp</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a816d7555c6b7690d7afdd81eb62dd35b"><td class="memItemLeft" align="right" valign="top">cv::Mat&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classLaneDetector.html#a816d7555c6b7690d7afdd81eb62dd35b">deNoise</a> (cv::Mat inputImage)</td></tr>
<tr class="memdesc:a816d7555c6b7690d7afdd81eb62dd35b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Apply gaussian filter to the input image to denoise it.  <a href="#a816d7555c6b7690d7afdd81eb62dd35b">More...</a><br /></td></tr>
<tr class="separator:a816d7555c6b7690d7afdd81eb62dd35b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8920b291267aad638f8874512fba33cf"><td class="memItemLeft" align="right" valign="top">cv::Mat&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classLaneDetector.html#a8920b291267aad638f8874512fba33cf">edgeDetector</a> (cv::Mat img_noise)</td></tr>
<tr class="memdesc:a8920b291267aad638f8874512fba33cf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Detect all the edges in the blurred frame by filtering the image.  <a href="#a8920b291267aad638f8874512fba33cf">More...</a><br /></td></tr>
<tr class="separator:a8920b291267aad638f8874512fba33cf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a64d74d2971d1e14175ef58dfbb391f6d"><td class="memItemLeft" align="right" valign="top">cv::Mat&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classLaneDetector.html#a64d74d2971d1e14175ef58dfbb391f6d">mask</a> (cv::Mat img_edges)</td></tr>
<tr class="memdesc:a64d74d2971d1e14175ef58dfbb391f6d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Mask the image so that only the edges that form part of the lane are detected.  <a href="#a64d74d2971d1e14175ef58dfbb391f6d">More...</a><br /></td></tr>
<tr class="separator:a64d74d2971d1e14175ef58dfbb391f6d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adbbc2f50aee10844aeec12b1fe084fb2"><td class="memItemLeft" align="right" valign="top">std::vector&lt; cv::Vec4i &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classLaneDetector.html#adbbc2f50aee10844aeec12b1fe084fb2">houghLines</a> (cv::Mat img_mask)</td></tr>
<tr class="memdesc:adbbc2f50aee10844aeec12b1fe084fb2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Obtain all the line segments in the masked images which are going to be part of the lane boundaries.  <a href="#adbbc2f50aee10844aeec12b1fe084fb2">More...</a><br /></td></tr>
<tr class="separator:adbbc2f50aee10844aeec12b1fe084fb2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8005c489f194eded3bc5a76cfc496c43"><td class="memItemLeft" align="right" valign="top">std::vector&lt; std::vector&lt; cv::Vec4i &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classLaneDetector.html#a8005c489f194eded3bc5a76cfc496c43">lineSeparation</a> (std::vector&lt; cv::Vec4i &gt; lines, cv::Mat img_edges)</td></tr>
<tr class="memdesc:a8005c489f194eded3bc5a76cfc496c43"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sort all the detected Hough lines by slope.  <a href="#a8005c489f194eded3bc5a76cfc496c43">More...</a><br /></td></tr>
<tr class="separator:a8005c489f194eded3bc5a76cfc496c43"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac9a862f41a23ab0c3bfed2ce512a56d8"><td class="memItemLeft" align="right" valign="top">std::vector&lt; cv::Point &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classLaneDetector.html#ac9a862f41a23ab0c3bfed2ce512a56d8">regression</a> (std::vector&lt; std::vector&lt; cv::Vec4i &gt; &gt; left_right_lines, cv::Mat inputImage)</td></tr>
<tr class="memdesc:ac9a862f41a23ab0c3bfed2ce512a56d8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Regression takes all the classified line segments initial and final points and fits a new lines out of them using the method of least squares.  <a href="#ac9a862f41a23ab0c3bfed2ce512a56d8">More...</a><br /></td></tr>
<tr class="separator:ac9a862f41a23ab0c3bfed2ce512a56d8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a84053373ae184e752f023658fb187241"><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classLaneDetector.html#a84053373ae184e752f023658fb187241">predictTurn</a> ()</td></tr>
<tr class="memdesc:a84053373ae184e752f023658fb187241"><td class="mdescLeft">&#160;</td><td class="mdescRight">Predict if the lane is turning left, right or if it is going straight.  <a href="#a84053373ae184e752f023658fb187241">More...</a><br /></td></tr>
<tr class="separator:a84053373ae184e752f023658fb187241"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9564c3349f0fa5a7da7968b9461e2730"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classLaneDetector.html#a9564c3349f0fa5a7da7968b9461e2730">plotLane</a> (cv::Mat inputImage, std::vector&lt; cv::Point &gt;, std::string turn)</td></tr>
<tr class="memdesc:a9564c3349f0fa5a7da7968b9461e2730"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function plots both sides of the lane, the turn prediction message and a transparent polygon that covers the area inside the lane boundaries.  <a href="#a9564c3349f0fa5a7da7968b9461e2730">More...</a><br /></td></tr>
<tr class="separator:a9564c3349f0fa5a7da7968b9461e2730"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Definition of the <a class="el" href="classLaneDetector.html" title="Definition of the LaneDetector class. It contains all the functions and variables depicted in the...">LaneDetector</a> class. It contains all the functions and variables depicted in the. </p>
<p>Activity diagram and UML Class diagram. It detects the lanes in an image if a highway and outputs the same image with the plotted lane. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a816d7555c6b7690d7afdd81eb62dd35b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cv::Mat LaneDetector::deNoise </td>
          <td>(</td>
          <td class="paramtype">cv::Mat&#160;</td>
          <td class="paramname"><em>inputImage</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Apply gaussian filter to the input image to denoise it. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">inputImage</td><td>is the frame of a video in which the </td></tr>
    <tr><td class="paramname">lane</td><td>is going to be detected </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Blurred and denoised image </dd></dl>

</div>
</div>
<a class="anchor" id="a8920b291267aad638f8874512fba33cf"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cv::Mat LaneDetector::edgeDetector </td>
          <td>(</td>
          <td class="paramtype">cv::Mat&#160;</td>
          <td class="paramname"><em>img_noise</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Detect all the edges in the blurred frame by filtering the image. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">img_noise</td><td>is the previously blurred frame </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Binary image with only the edges represented in white </dd></dl>

</div>
</div>
<a class="anchor" id="adbbc2f50aee10844aeec12b1fe084fb2"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::vector&lt; cv::Vec4i &gt; LaneDetector::houghLines </td>
          <td>(</td>
          <td class="paramtype">cv::Mat&#160;</td>
          <td class="paramname"><em>img_mask</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Obtain all the line segments in the masked images which are going to be part of the lane boundaries. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">img_mask</td><td>is the masked binary image from the previous function </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Vector that contains all the detected lines in the image </dd></dl>

</div>
</div>
<a class="anchor" id="a8005c489f194eded3bc5a76cfc496c43"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::vector&lt; std::vector&lt; cv::Vec4i &gt; &gt; LaneDetector::lineSeparation </td>
          <td>(</td>
          <td class="paramtype">std::vector&lt; cv::Vec4i &gt;&#160;</td>
          <td class="paramname"><em>lines</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">cv::Mat&#160;</td>
          <td class="paramname"><em>img_edges</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sort all the detected Hough lines by slope. </p>
<p>The lines are classified into right or left depending on the sign of their slope and their approximate location </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">lines</td><td>is the vector that contains all the detected lines </td></tr>
    <tr><td class="paramname">img_edges</td><td>is used for determining the image center </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The output is a vector(2) that contains all the classified lines </dd></dl>

</div>
</div>
<a class="anchor" id="a64d74d2971d1e14175ef58dfbb391f6d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cv::Mat LaneDetector::mask </td>
          <td>(</td>
          <td class="paramtype">cv::Mat&#160;</td>
          <td class="paramname"><em>img_edges</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Mask the image so that only the edges that form part of the lane are detected. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">img_edges</td><td>is the edges image from the previous function </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Binary image with only the desired edges being represented </dd></dl>

</div>
</div>
<a class="anchor" id="a9564c3349f0fa5a7da7968b9461e2730"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int LaneDetector::plotLane </td>
          <td>(</td>
          <td class="paramtype">cv::Mat&#160;</td>
          <td class="paramname"><em>inputImage</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::vector&lt; cv::Point &gt;&#160;</td>
          <td class="paramname"><em>lane</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::string&#160;</td>
          <td class="paramname"><em>turn</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function plots both sides of the lane, the turn prediction message and a transparent polygon that covers the area inside the lane boundaries. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">inputImage</td><td>is the original captured frame </td></tr>
    <tr><td class="paramname">lane</td><td>is the vector containing the information of both lines </td></tr>
    <tr><td class="paramname">turn</td><td>is the output string containing the turn information </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The function returns a 0 </dd></dl>

</div>
</div>
<a class="anchor" id="a84053373ae184e752f023658fb187241"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::string LaneDetector::predictTurn </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Predict if the lane is turning left, right or if it is going straight. </p>
<p>It is done by seeing where the vanishing point is with respect to the center of the image </p><dl class="section return"><dt>Returns</dt><dd>String that says if there is left or right turn or if the road is straight </dd></dl>

</div>
</div>
<a class="anchor" id="ac9a862f41a23ab0c3bfed2ce512a56d8"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::vector&lt; cv::Point &gt; LaneDetector::regression </td>
          <td>(</td>
          <td class="paramtype">std::vector&lt; std::vector&lt; cv::Vec4i &gt; &gt;&#160;</td>
          <td class="paramname"><em>left_right_lines</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">cv::Mat&#160;</td>
          <td class="paramname"><em>inputImage</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Regression takes all the classified line segments initial and final points and fits a new lines out of them using the method of least squares. </p>
<p>This is done for both sides, left and right. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">left_right_lines</td><td>is the output of the lineSeparation function </td></tr>
    <tr><td class="paramname">inputImage</td><td>is used to select where do the lines will end </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>output contains the initial and final points of both lane boundary lines </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>/home/michi/Desktop/UMD/ENPM808X/Midterm/workspace/Lane-Detection-for-Autonomous-Cars/include/<a class="el" href="LaneDetector_8hpp_source.html">LaneDetector.hpp</a></li>
<li>/home/michi/Desktop/UMD/ENPM808X/Midterm/workspace/Lane-Detection-for-Autonomous-Cars/LaneDetector/<a class="el" href="LaneDetector_8cpp.html">LaneDetector.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
